package com.fangcun.bean.sys;

import javax.servlet.http.HttpServletRequest;

import com.fangcun.common.canstant.ErrCode;
import com.fangcun.common.util.PublicMethod;

/**
 * @作者： 陳曉鬆 @时间： 2018年5月12日 - 下午10:08:46 @description：->
 */
public class ResponseMsg {

	/** 存入Attribute的sessionId昵称 **/
	public static final String SESSIONID = "sessionId";

	/** 码 **/
	private Integer returnCode = ErrCode.SUC.getReturnCode();
	/** 提示信息 **/
	private String returnMsg = ErrCode.SUC.getReturnMsg();
	/** 数据 **/
	private Object data;
	/** 错误系统提示 **/
	private Object exceptionMsg;

	private Object sessionId;

	public Object getReturnCode() {
		return returnCode;
	}

	public ResponseMsg setReturnCode(Integer returnCode) {
		this.returnCode = returnCode;
		return this;
	}

	public Object getReturnMsg() {
		return returnMsg;
	}

	public ResponseMsg setReturnMsg(String returnMsg) {
		this.returnMsg = returnMsg;
		return this;
	}

	public Object getData() {
		return data;
	}

	public ResponseMsg setData(Object data) {
		this.data = data;
		return this;
	}

	public Object getExceptionMsg() {
		return exceptionMsg;
	}

	public ResponseMsg setExceptionMsg(Object exceptionMsg) {
		this.exceptionMsg = exceptionMsg;
		return this;
	}

	public Object getSessionId() {
		HttpServletRequest request = PublicMethod.getRequest();
		if (request != null) {
			sessionId = request.getAttribute(SESSIONID);
		}
		return sessionId;
	}

	public ResponseMsg setSessionId(String sessionId) {
		this.sessionId = sessionId;
		return this;
	}

	public static ResponseMsg returnBeanBuild() {
		ResponseMsg bean = new ResponseMsg();
		bean.setReturnCode(ErrCode.SUC.getReturnCode());
		bean.setReturnMsg(ErrCode.SUC.getReturnMsg());
		return bean;
	}

}